<template>
  <div class="home-container">
    <div class="content-box">
      <div class="left-panel">
        <div class="menu-header" @click="navigateToICU">
          ICU临床信息系统
        </div>
        <div class="menu-container">
          <div class="menu-item" @click="navigateTo('doctor')">
            <div class="icon-circle">👨🏻‍⚕️</div>
            <span>医生工作站</span>
          </div>
          <div class="menu-item" @click="navigateTo('nurse')">
            <div class="icon-circle">👩🏻‍⚕️</div>
            <span>护理工作站</span>
          </div>
          <div class="menu-item" @click="navigateTo('admin')">
            <div class="icon-circle">📋</div>
            <span>管理工作站</span>
          </div>
          <div class="menu-item" @click="navigateTo('settings')">
            <div class="icon-circle">⚙️</div>
            <span>系统设置</span>
          </div>
        </div>
      </div>
      <div class="right-panel">
        <div class="right-top">
          <div class="notice-header">重要功能更新通知：</div>
          <ul class="notice-list">
            <li v-for="(notice, index) in notices" :key="index">{{ notice }}</li>
          </ul>
        </div>
        <div class="right-bottom">
          <div class="support-header">技术支持：</div>
          <ul class="support-list">
            <li v-for="(support, index) in supports" :key="index">{{ support }}</li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang='ts'>
import { useRouter } from 'vue-router'
import { ref } from 'vue'

const router = useRouter()
const notices = ref([
  '新增患者生命体征实时监测功能',
  '优化医嘱执行流程',
  '修复已知系统bug',
  '提升系统响应速度'
])

const supports = ref([
  '信息中心：010-12345678',
  '设备科：010-87654321',
  '临床工程部：010-11223344',
  '系统维护组：010-55667788'
])

const navigateToICU = () => {
  router.push('/icu')
}

const navigateTo = (type: string) => {
  switch (type) {
    case 'doctor':
      router.push('/doctor')
      break
    case 'nurse':
      router.push('/nurse')
      break
    case 'admin':
      router.push('/admin')
      break
    case 'settings':
      router.push('/settings')
      break
    default:
      router.push('/')
  }
}
</script>

<style scoped>
.home-container {
  background-color: #007080;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: white;
  padding: 20px;
}

.content-box {
  background-color: transparent;
  width: 100vmin;
  height: 80vmin;
  min-width: 900px;
  min-height: 700px;
  padding: 30px;
  border-radius: 8px;
  aspect-ratio: 1/1;
  display: flex;
  gap: 10px;
  position: absolute;
  top: 60px;
  left: 60px;
}

.left-panel {
  flex: 2;
  background-color: rgba(0, 70, 85, 0.8);
  border-radius: 8px;
  padding: 20px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.menu-header {
  padding: 12px;
  font-size: 1.5em;
  font-weight: bold;
  margin-bottom: 15px;
}

.menu-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
}

.menu-item span {
  white-space: nowrap;
}

.menu-item {
  padding: 15px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 1.4em;
  font-weight: bold;
  background-color: rgba(0, 105, 122, 0.5);
  color: white;
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 60px;
}

.menu-item>.icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  margin-right: 15px;
  flex-shrink: 0;
  margin-left: 10px;
}

.menu-item:hover {
  background-color: rgba(0, 105, 122, 0.7);
  transform: translateY(-2px);
}

.right-panel {
  flex: 1.5;
  background-color: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.right-top {
  flex: 1;
  background-color: rgba(0, 70, 85, 0.8);
  border-radius: 8px;
  padding: 20px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.notice-header,
.support-header {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 10px;
}

.notice-list,
.support-list {
  flex: 1;
  overflow-y: auto;
  padding-left: 20px;
  margin: 0;
  max-height: 200px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.1);
}

.notice-list::-webkit-scrollbar,
.support-list::-webkit-scrollbar {
  width: 6px;
}

.notice-list::-webkit-scrollbar-track,
.support-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.notice-list::-webkit-scrollbar-thumb,
.support-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.notice-list li,
.support-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.right-bottom {
  flex: 1;
  background-color: rgba(0, 70, 85, 0.8);
  border-radius: 8px;
  padding: 20px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}
</style>
